package com.codi.bus.core.service.model;

import com.codi.base.util.DateUtils;
import com.codi.base.util.MoneyUtils;
import com.codi.base.util.StringUtil;
import com.codi.bus.constant.GlobalConstant;
import lombok.Data;
import lombok.experimental.Accessors;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 模块名
 *
 * @author spy
 * @version 1.0 2017-11-30 14:24
 * @since 1.0
 */
@Data
@Accessors(chain = true)
public class TradeBuyModel {
    // 申请编号
    private String allotNo;

    // 发生金额
    private BigDecimal balance;

    // 申购金额字符串
    public String getBalanceString() {
        return MoneyUtils.formatMoney(balance, 2);
    }

    // 清算日期
    private String clearDate;

    // 申请时间
    private String applyTime;

    public String getApplyTime() {
        if (!StringUtil.isEmpty(applyTime)) {
            Date date = DateUtils.stringToDate(applyTime, GlobalConstant.DATE_FORMAT_HHMMSS);
            return DateUtils.dateToTime(date);
        }
        return this.applyTime;
    }


    // 申请日期
    private String applyDate;

    public String getApplyDate() {
        if (!StringUtil.isEmpty(applyDate)) {
            Date date = DateUtils.stringToDate(applyDate, GlobalConstant.DATE_FORMAT_YYYYMMDD);
            return DateUtils.dateToSimpleStr(date);
        }
        return this.applyDate;
    }

    // 下单日期
    private String orderDate;
    // 下单时间
    private String orderTime;
}
